const userService = require('../service/user')
const addUesrController = async (ctx,next) => {
    let results = await userService.addUserService(ctx.request.body)
    if(results){
        ctx.body = {
            code:200,
            message:'add success'
        }
    }  else{
        ctx.body = {
            code:403,
            message:'params err'
        }
    }
}
const deleteUserController = async (ctx,next) => {
    let results = await userService.deleteUserService(ctx.request.id)
    if(results){
        ctx.body = {
            code:200,
            message:'delete success'
        }
    }  else{
        ctx.body = {
            code:403,
            message:'params err'
        }
    }
}
const putUserController = async (ctx,next) => {
    let results = await userService.deleteUserService(ctx.params.id)
    if(results){
        ctx.body = {
            code:200,
            message:'update success'
        }
    }  else{
        ctx.body = {
            code:403,
            message:'params err'
        }
    }
}


module.exports = {
    addUesrController,
    deleteUserController,
    putUserController,
}
